package pers.bc.utils.net;

import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import pers.bc.utils.constant.IPubEvnCons;
import pers.bc.utils.pub.JsonUtil;
import pers.bc.utils.useragentutils.Browser;
import pers.bc.utils.useragentutils.OperatingSystem;
import pers.bc.utils.useragentutils.UserAgent;

/**
 * 
 **
 * @qualiFild pers.bc.utils.net.UserAgentUtil.java<br>
 * @author：LiBencheng<br>
 * @date Created on 2025年11月7日<br>
 * @version 1.0<br>
 */
public class UserAgentUtil
{
    
    /**
     * *********************************************************** <br>
     * *说明： 获取完整的客户端信息 <br>
     * @see <br>
     * @param request
     * @return <br> 
     * @Map<String,Object> <br>
     * @methods pers.bc.utils.net.UserAgentUtil#extractClientInfo <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:35:58 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    public Map<String, Object> getClientInfo(final jakarta.servlet.http.HttpServletRequest request)
    {
        Map<String, Object> clientInfo = new LinkedHashMap<String, Object>()
        {
            /** @date 2025年11月7日 */
            private static final long serialVersionUID = 6231105222703007795L;
            
            {
                // 基本信息
                put("ipAddress", getClientIpAddress(request));
                put("userAgent", getUserAgent(request));
                put("acceptLanguage", getAcceptLanguage(request));
                put("acceptEncoding", getAcceptEncoding(request));
                
                // 网络信息
                put("networkInfo", getNetworkInfo(request));
                
                // 请求信息
                put("requestInfo", getRequestInfo(request));
                
                // 头部信息
                put("headers", getAllHeaders(request));
            }
        };
        
        return clientInfo;
    }
    
    /**
     * *********************************************************** <br>
     * *说明：获取客户端真实IP地址 <br>
     * @see <br>
     * @param request
     * @return <br>
     * @String <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getClientIpAddress <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:35:41 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    public String getClientIpAddress(jakarta.servlet.http.HttpServletRequest request)
    {
        String ipAddress = request.getHeader("X-Forwarded-For");
        
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress)) ipAddress = request.getHeader("X-Real-IP");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("Proxy-Client-IP");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("WL-Proxy-Client-IP");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("HTTP_CLIENT_IP");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("HTTP_X_FORWARDED_FOR");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress)) //
            ipAddress = request.getRemoteAddr();
        
        // 多个IP时取第一个
        if (ipAddress != null && ipAddress.contains(","))//
            ipAddress = ipAddress.split(",")[0].trim();
        
        return ipAddress;
    }
    
    /** 获取用户代理信息 */
    public String getUserAgent(jakarta.servlet.http.HttpServletRequest request)
    {
        return request.getHeader("User-Agent");
    }
    
    /** 获取客户端语言偏好 */
    public String getAcceptLanguage(jakarta.servlet.http.HttpServletRequest request)
    {
        return request.getHeader("Accept-Language");
    }
    
    /** 获取客户端支持的编码 */
    public String getAcceptEncoding(jakarta.servlet.http.HttpServletRequest request)
    {
        return request.getHeader("Accept-Encoding");
    }
    
    /**
     * *********************************************************** <br>
     * *说明： 获取网络相关信息<br>
     * @see <br>
     * @param request
     * @return <br>
     * @Map<String,String> <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getNetworkInfo <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:46:55 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    public Map<String, String> getNetworkInfo(final jakarta.servlet.http.HttpServletRequest request)
    {
        Map<String, String> networkInfo = new LinkedHashMap<String, String>()
        {
            /** @date 2025年11月7日 */
            private static final long serialVersionUID = 6231105222703007795L;
            
            {
                put("remoteAddr", request.getRemoteAddr());
                put("remoteHost", request.getRemoteHost());
                put("remotePort", request.getRemotePort() + "");
                
                // local信息
                put("localAddr", request.getLocalAddr());
                put("localPort", request.getLocalPort() + "");
                put("localName", request.getLocalName());
                
                put("serverName", request.getServerName());
                put("serverPort", request.getServerPort() + "");
                put("scheme", request.getScheme());
                
            }
        };
        
        return networkInfo;
    }
    
    /**
     * *********************************************************** <br>
     * *说明： 获取请求相关信息 <br>
     * @see <br>
     * @param request
     * @return <br>
     * @Map<String,Object> <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getRequestInfo <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:34:01 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    public Map<String, String> getRequestInfo(final jakarta.servlet.http.HttpServletRequest request)
    {
        Map<String, String> requestInfo = new LinkedHashMap<String, String>()
        {
            /** @date 2025年11月7日 */
            private static final long serialVersionUID = 6231105222703007795L;
            {
                put("method", request.getMethod());
                put("protocol", request.getProtocol());
                put("contentType", request.getContentType());
                put("contentLength", request.getContentLength() + "");
                put("characterEncoding", request.getCharacterEncoding());
                put("queryString", request.getQueryString());
                put("requestURI", request.getRequestURI());
                put("requestURL", request.getRequestURL().toString());
                put("contextPath", request.getContextPath());
                put("servletPath", request.getServletPath());
                put("pathInfo", request.getPathInfo());
            }
        };
        
        return requestInfo;
    }
    
    /**
     * *********************************************************** <br>
     * *说明：获取所有请求头信息 <br>
     * @see <br>
     * @param request
     * @return <br>
     * @Map<String,String> <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getAllHeaders <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:34:08 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    public Map<String, String> getAllHeaders(jakarta.servlet.http.HttpServletRequest request)
    {
        Map<String, String> headers = new HashMap<>();
        Enumeration<String> headerNames = request.getHeaderNames();
        
        while (headerNames.hasMoreElements())
        {
            String headerName = headerNames.nextElement();
            String headerValue = request.getHeader(headerName);
            headers.put(headerName, headerValue);
        }
        
        return headers;
    }
    
    /**
     * *********************************************************** <br>
     * *说明：判断是否为移动设备 <br>
     * @see <br>
     * @param request
     * @return <br>
     * @boolean <br>
     * @methods pers.bc.utils.net.UserAgentUtil#isMobileDevice <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:34:15 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    public boolean isMobileDevice(jakarta.servlet.http.HttpServletRequest request)
    {
        String userAgent = getUserAgent(request);
        if (userAgent == null) return false;
        
        String[] mobileKeywords = {"Mobile", "Android", "iPhone", "iPad", "Windows Phone", "BlackBerry", "webOS", "Opera Mini", "IEMobile"};
        
        for (String keyword : mobileKeywords)
            if (userAgent.toLowerCase().contains(keyword.toLowerCase())) return true;
        
        return false;
    }
    
    /**
     * *********************************************************** <br>
     * *说明： 获取客户端时区信息（如果提供）<br>
     * @see <br>
     * @param request
     * @return <br>
     * @String <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getClientTimezone <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:34:29 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    public String getClientTimezone(jakarta.servlet.http.HttpServletRequest request)
    {
        return request.getHeader("Time-Zone");
    }
    
    // --------------------- javax.servlet.http.HttpServletRequest-----------------------------------
    /**
     * *********************************************************** <br>
     * *说明：获取完整的客户信息 <br>
     * @see <br>
     * @param request
     * @return <br>
     * @ClientInfo <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getCompleteClientInfo <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:24:09 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    @SuppressWarnings("restriction")
    public static ClientInfo getCompleteClientInfo(final javax.servlet.http.HttpServletRequest request)
    {
        ClientInfo clientInfo = new ClientInfo();
        
        // IP地址
        clientInfo.setIpAddress(getClientIpAddress(request));
        
        // 用户代理和浏览器信息
        String userAgent = request.getHeader("User-Agent");
        clientInfo.setUserAgent(userAgent);
        clientInfo.setBrowser(parseBrowser(userAgent));
        clientInfo.setOs(parseOperatingSystem(userAgent));
        clientInfo.setDeviceType(parseDeviceType(userAgent));
        
        // 引用来源
        clientInfo.setReferer(request.getHeader("Referer"));
        // 主机信息
        clientInfo.setHost(request.getHeader("Host"));
        
        // 语言偏好
        clientInfo.setAcceptLanguage(request.getHeader("Accept-Language"));
        
        // Cookie信息
        clientInfo.setCookies(parseCookies(request));
        
        // 访问时间
        clientInfo.setAccessTime(new Date());
        
        return clientInfo;
    }
    
    // --------------------- 高级版本 - 包含浏览器和设备检测 -----------------------------------
    /**
     * *********************************************************** <br>
     * *说明：解析浏览器类型 <br>
     * @see <br>
     * @param userAgent
     * @return <br>
     * @String <br>
     * @methods pers.bc.utils.net.UserAgentUtil#parseBrowser <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:29:27 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    private static String parseBrowser(String userAgent)
    {
        if (userAgent == null) return "Unknown";
        userAgent = userAgent.toLowerCase();
        
        if (userAgent.contains("chrome") && !userAgent.contains("edg")) return "Chrome";
        else if (userAgent.contains("firefox")) return "Firefox";
        else if (userAgent.contains("safari") && !userAgent.contains("chrome")) return "Safari";
        else if (userAgent.contains("edg")) return "Edge";
        else if (userAgent.contains("opera")) return "Opera";
        else
            return "Other";
        
    }
    
    /**
     * *********************************************************** <br>
     * *说明：解析操作系统 <br>
     * @see <br>
     * @param userAgent
     * @return <br>
     * @String <br>
     * @methods pers.bc.utils.net.UserAgentUtil#parseOperatingSystem <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:29:36 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    private static String parseOperatingSystem(String userAgent)
    {
        if (userAgent == null) return "Unknown";
        userAgent = userAgent.toLowerCase();
        
        if (userAgent.contains("windows")) return "Windows";
        else if (userAgent.contains("mac os")) return "Mac OS";
        else if (userAgent.contains("linux")) return "Linux";
        else if (userAgent.contains("android")) return "Android";
        else if (userAgent.contains("ios") || userAgent.contains("iphone")) return "iOS";
        else
            return "Other";
    }
    
    /**
     * *********************************************************** <br>
     * *说明：解析设备类型 <br>
     * @see <br>
     * @param userAgent
     * @return <br>
     * @String <br>
     * @methods pers.bc.utils.net.UserAgentUtil#parseDeviceType <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:27:57 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    private static String parseDeviceType(String userAgent)
    {
        if (userAgent == null) return "Unknown";
        
        userAgent = userAgent.toLowerCase();
        
        if (userAgent.contains("mobile") || userAgent.contains("android") || userAgent.contains("iphone") || userAgent.contains("ipad"))
            return "Mobile";
        else if (userAgent.contains("tablet")) //
            return "Tablet";
        else
            return "Desktop";
    }
    
    /**
     * *********************************************************** <br>
     * *说明：解析Cookie <br>
     * @see <br>
     * @param request
     * @return <br>
     * @Map<String,String> <br>
     * @methods pers.bc.utils.net.UserAgentUtil#parseCookies <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:26:07 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    @SuppressWarnings("restriction")
    private static Map<String, String> parseCookies(final javax.servlet.http.HttpServletRequest request)
    {
        Map<String, String> cookies = new HashMap<>();
        javax.servlet.http.Cookie[] requestCookies = request.getCookies();
        
        if (requestCookies != null) //
            for (javax.servlet.http.Cookie cookie : requestCookies)
            cookies.put(cookie.getName(), cookie.getValue());
        
        return cookies;
    }
    
    /**
     * *********************************************************** <br>
     * *说明：获取真实的客户端IP地址（考虑代理情况） <br>
     * @see <br>
     * @param request
     * @return <br>
     * @String <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getClientIpAddress <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:20:40 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    @SuppressWarnings("restriction")
    public static String getClientIpAddress(final javax.servlet.http.HttpServletRequest request)
    {
        String ipAddress = request.getHeader("X-Forwarded-For");
        
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("Proxy-Client-IP");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("WL-Proxy-Client-IP");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("HTTP_X_FORWARDED_FOR");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("HTTP_X_FORWARDED");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("HTTP_X_CLUSTER_CLIENT_IP");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("HTTP_CLIENT_IP");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("HTTP_FORWARDED_FOR");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress))
            ipAddress = request.getHeader("HTTP_FORWARDED");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress)) //
            ipAddress = request.getRemoteAddr();
        
        // 对于多个IP的情况（如X-Forwarded-For: client, proxy1, proxy2），取第一个IP
        if (ipAddress != null && ipAddress.contains(","))//
            ipAddress = ipAddress.split(",")[0].trim();
        
        return ipAddress;
    }
    
    /**
     * *********************************************************** <br>
     * *说明： 获取所有请求头信息<br>
     * @see <br>
     * @param request
     * @return <br>
     * @Map<String,String> <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getAllHeaders <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 14:17:17 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    @SuppressWarnings("restriction")
    public static Map<String, String> getAllHeaders(final javax.servlet.http.HttpServletRequest request)
    {
        Map<String, String> headers = new LinkedHashMap<String, String>()
        {
            /** @date 2025年11月7日 */
            private static final long serialVersionUID = -7404853906160147539L;
            {
                Enumeration<String> headerNames = request.getHeaderNames();
                while (headerNames.hasMoreElements())
                    put(headerNames.nextElement(), request.getHeader(headerNames.nextElement()));
            }
        };
        
        return headers;
    }
    
    /**
     * *********************************************************** <br>
     * *说明：获取基本客户信息 <br>
     * javax.servlet.http.HttpServletRequest <br>
     * @see <br>
     * @param request
     * @return <br>
     * @Map<String,String> <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getCltInfo <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 13:49:26 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    @SuppressWarnings("restriction")
    public static Map<String, String> getClientInfo(final javax.servlet.http.HttpServletRequest request)
    {
        Map<String, String> clientInfo = new LinkedHashMap<String, String>()
        {
            /** @date 2025年11月7日 */
            private static final long serialVersionUID = -7404853906160147539L;
            {
                // IP地址信息
                put("remoteAddr", request.getRemoteAddr());
                put("remoteHost", request.getRemoteHost());
                put("remotePort", request.getRemotePort() + "");
                
                // 用户代理和浏览器信息
                put("userAgent", request.getHeader("User-Agent"));
                put("accept", request.getHeader("Accept"));
                put("acceptLanguage", request.getHeader("Accept-Language"));
                put("acceptEncoding", request.getHeader("Accept-Encoding"));
                
                // 请求信息
                put("method", request.getMethod());
                put("requestURI", request.getRequestURI());
                put("queryString", request.getQueryString());
                put("protocol", request.getProtocol());
                
                // 会话信息
                put("sessionId", request.getSession().getId());
                put("requestedSessionId", request.getRequestedSessionId());
                
                // local信息
                put("localAddr", request.getLocalAddr());
                put("localPort", request.getLocalPort() + "");
                put("localName", request.getLocalName());
                
                // server信息
                put("serverName", request.getServerName());
                put("serverPort", request.getServerPort() + "");
                put("scheme", request.getScheme());
                
            }
        };
        
        return clientInfo;
    }
    
    /**
     * *********************************************************** <br>
     * *说明： <br>
     * @see <br>
     * @param request
     * @return <br>
     * @String <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getCltInfo <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 15:10:46 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    @SuppressWarnings({"restriction", "unchecked"})
    public static String getCltInfo(final jakarta.servlet.http.HttpServletRequest request)
    {
        try
        {
            return JsonUtil.transObj2Josn(new LinkedHashMap()
            {
                /** @date 2024-11-15 */
                private static final long serialVersionUID = 5000776009858995259L;
                {
                    // 解析agent字符串
                    @SuppressWarnings("restriction")
                    UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
                    // 获取浏览器对象
                    Browser browser = userAgent.getBrowser();
                    // 获取操作系统对象
                    OperatingSystem operatingSystem = userAgent.getOperatingSystem();
                    put("浏览器ID", browser.getId());
                    put("浏览器名", browser.getName());
                    put("浏览器类型", browser.getBrowserType());
                    put("浏览器家族", browser.getGroup());
                    put("浏览器生产厂商", browser.getManufacturer());
                    put("浏览器版本", userAgent.getBrowserVersion());
                    put("浏览器使用的渲染引擎", browser.getRenderingEngine());
                    
                    put("操作系统ID", operatingSystem.getId());
                    put("操作系统名", operatingSystem.getName());
                    put("访问设备类型", operatingSystem.getDeviceType());
                    put("操作系统家族", operatingSystem.getGroup());
                    put("操作系统生产厂商", operatingSystem.getManufacturer()); // IP地址信息
                  
                    put("ClientIP", request.getRemoteAddr()+":"+request.getRemotePort());

                }
            });
        }
        catch (Exception e)
        {
            return IPubEvnCons.EMPTY;
        }
    }
    
    /**
     * *********************************************************** <br>
     * *说明： <br>
     * @see <br>
     * @param request
     * @return <br>
     * @String <br>
     * @methods pers.bc.utils.net.UserAgentUtil#getCltInfo <br>
     * @author LiBencheng <br>
     * @date Created on 2025年11月7日 <br>
     * @time 15:10:35 <br>
     * @version 1.0 <br>
     *************************************************************          <br>
     */
    @SuppressWarnings({"restriction", "unchecked"})
    public static String getCltInfo(final javax.servlet.http.HttpServletRequest request)
    {
        try
        {
            return JsonUtil.transObj2Josn(new LinkedHashMap()
            {
                {
                    // 解析agent字符串
                    @SuppressWarnings("restriction")
                    UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
                    // 获取浏览器对象
                    Browser browser = userAgent.getBrowser();
                    // 获取操作系统对象
                    OperatingSystem operatingSystem = userAgent.getOperatingSystem();
                    put("浏览器ID", browser.getId());
                    put("浏览器名", browser.getName());
                    put("浏览器类型", browser.getBrowserType());
                    put("浏览器家族", browser.getGroup());
                    put("浏览器生产厂商", browser.getManufacturer());
                    put("浏览器版本", userAgent.getBrowserVersion());
                    put("浏览器使用的渲染引擎", browser.getRenderingEngine());
                    
                    put("操作系统ID", operatingSystem.getId());
                    put("操作系统名", operatingSystem.getName());
                    put("访问设备类型", operatingSystem.getDeviceType());
                    put("操作系统家族", operatingSystem.getGroup());
                    put("操作系统生产厂商", operatingSystem.getManufacturer());
                    
                    put("ClientIP", request.getRemoteAddr()+":"+request.getRemotePort());
                    
                }
            });
        }
        catch (Exception e)
        {
            return IPubEvnCons.EMPTY;
        }
    }
    
    public static UserAgent parse(String userAgentString)
    {
        return UserAgent.parseUserAgentString(userAgentString);
    }
    
    /**
     * 完整的客户信息对象
     **
     * @qualiFild pers.bc.utils.net.UserAgentUtil.java<br>
     * @author：LiBencheng<br>
     * @date Created on 2025年11月7日<br>
     * @version 1.0<br>
     */
    public static class ClientInfo
    {
        private String ipAddress;
        private String userAgent;
        private String browser;
        private String os;
        private String deviceType;
        private String referer;
        private String host;
        private String acceptLanguage;
        private Map<String, String> cookies;
        private Date accessTime;
        
        // 构造函数、getter和setter省略
        // 实际使用时应该添加
        
        public String getIpAddress()
        {
            return ipAddress;
        }
        
        public void setIpAddress(String ipAddress)
        {
            this.ipAddress = ipAddress;
        }
        
        public String getUserAgent()
        {
            return userAgent;
        }
        
        public void setUserAgent(String userAgent)
        {
            this.userAgent = userAgent;
        }
        
        public String getBrowser()
        {
            return browser;
        }
        
        public void setBrowser(String browser)
        {
            this.browser = browser;
        }
        
        public String getOs()
        {
            return os;
        }
        
        public void setOs(String os)
        {
            this.os = os;
        }
        
        public String getDeviceType()
        {
            return deviceType;
        }
        
        public void setDeviceType(String deviceType)
        {
            this.deviceType = deviceType;
        }
        
        public String getReferer()
        {
            return referer;
        }
        
        public void setReferer(String referer)
        {
            this.referer = referer;
        }
        
        public String getHost()
        {
            return host;
        }
        
        public void setHost(String host)
        {
            this.host = host;
        }
        
        public String getAcceptLanguage()
        {
            return acceptLanguage;
        }
        
        public void setAcceptLanguage(String acceptLanguage)
        {
            this.acceptLanguage = acceptLanguage;
        }
        
        public Map<String, String> getCookies()
        {
            return cookies;
        }
        
        public void setCookies(Map<String, String> cookies)
        {
            this.cookies = cookies;
        }
        
        public Date getAccessTime()
        {
            return accessTime;
        }
        
        public void setAccessTime(Date accessTime)
        {
            this.accessTime = accessTime;
        }
        
    }
}
